<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
<%@page import="java.*"%>
<%@page import="java.util.Vector"%>
<%@page import="model.*"%>
<jsp:useBean id="util" class="model.UtilForm" scope="session"></jsp:useBean>
<html:html xhtml="true" lang="true">
<head>

<title><bean:message key="welcome.title"/></title>
<html:base/>
<style type="text/css">
<!--
.style3 {
	font-size: 9px;
	color: #FF0000;
}
.style5 {color: #FF0000}
body {
	background-color: #FFFFFF;
}
-->
</style><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<script type="text/javascript">
function formatar()
{ 
	if(document.getElementById("cpf_cliente").id == "cpf_cliente")
	{
		limpacampos();
		if(document.getElementById("cpf_cliente").value.length == 14)
		{	
			var xx = document.getElementById("cpf_cliente").value;
			document.getElementById("cpf_cliente").value = xx;
		}
		else
		{
			var texto = document.getElementById("cpf_cliente").value;
			var tmp = texto.substring(0,3);
			tmp +=".";
			tmp +=texto.substring(3,6);
			tmp +=".";
			tmp += texto.substring(6,9);
			tmp += "-";
			tmp += texto.substring(9);
			document.getElementById("cpf_cliente").value = tmp;
			limpacampos();
		}
	}
	if(document.getElementById("cnpj_cliente").id == "cnpj_cliente")
	{
		limpacampos();
		if(document.getElementById("cnpj_cliente").value.length == 18)
		{	
			var xx = document.getElementById("cnpj_cliente").value;
			document.getElementById("cnpj_cliente").value = xx;
		}
		else
		{
			var texto = document.getElementById("cnpj_cliente").value;
			var tmp = texto.substring(0,2);
			tmp +=".";
			tmp += texto.substring(2,5);
			tmp +=".";
			tmp += texto.substring(5,8);
			tmp +="/";
			tmp += texto.substring(8,12);
			tmp +="-";
			tmp += texto.substring(12,15);
			document.getElementById("cnpj_cliente").value = tmp;
			limpacampos();
		}
	}
	
}
function limpacampos()
{	
	if(document.getElementById("cpf_cliente").value.length < 5)
		{	
			document.getElementById("cpf_cliente").value = "";
		}
		if(document.getElementById("cnpj_cliente").value.length < 6)
		{	
			document.getElementById("cnpj_cliente").value = "";
		}
	
}
</script>
<body>
<p>&nbsp;</p>
<html:errors/>
<html:form action="/CadastramentofinalSolicitacao">
<table width="421" height="214" border="0" align="center" bordercolor="#FFFFFF" bgcolor="#FFFFFF">
  <tr>
    <td colspan="2"><div align="center"><strong>Cadastro de Solicita&ccedil;&atilde;o </strong></div></td>
  </tr>
  <tr>
    <td><span class="style3">* Campos Obrigatorios</span></td>
    <td><!-- <bean:write name="util"  property="cod_cliente" /> --></td>
  </tr>
  <tr>
    <td><div align="left"><strong>Titulo</strong><span class="style5">*</span></div></td>
    <td><div align="left">
      <html:text property="titulo_solicitacao" disabled="false" size="80" maxlength="80" ></html:text>
    </div></td>
  </tr>
  <tr>
    <td><div align="left"><strong>Status</strong><span class="style5">*</span></div></td>
    <td><html:select property="cod_status">
    			 <%
		   			Vector status =(Vector) util.getVecstatus();	   
    			 	System.out.println(status.size());
    			 	System.out.println("Acima o tamanho");
		   			for(int i =0 ;i < status.size();i++ ) {
			  			StatusForm statusbean = (StatusForm)status.get(i);
			     %>
			     <html:option value="<%=(Integer.toString(statusbean.getCod_status())) %>">
			     <%=statusbean.getDescricao_status()%>
			     </html:option>
			    <%} %>
        	</html:select></td>
    
  </tr>
  <tr>
    <td><strong>C&oacute;digo Cliente </strong></td>
    <td><html:text property="cod_cliente" disabled="false" readonly="true" size="8" value="<%=util.getCod_cliente()%>" ></html:text></td>
  </tr>
  <tr>
    <td><strong>Forma Contato </strong></td>
    <td><html:checkbox property="contato_mail">Mail</html:checkbox><html:checkbox property="contato_pessoal">Pessoal</html:checkbox><html:checkbox property="contato_telefone">Telefone</html:checkbox></td>
  </tr>
  <tr>
    <td><strong>Motivo</strong></td>
    <td><html:select property="cod_motivo">
    			 <%
		   			Vector motivo =(Vector) util.getVecmotivo();	   
    			 	System.out.println(motivo.size());
    			 	System.out.println("Acima o tamanho");
		   			for(int i =0 ;i < motivo.size();i++ ) {
			  			MotivoForm motivobean = (MotivoForm)motivo.get(i);
			     %>
			     <html:option value="<%=(Integer.toString(motivobean.getCod_motivo())) %>">
			     <%=motivobean.getDescricao_motivo()%>
			     </html:option>
			    <%} %>
        	</html:select></td>
  </tr>
  <tr>
    <td><div align="left"><strong>Produto</strong></div></td>
    <td><html:select property="cod_produto">
    			 <%
		   			Vector produto =(Vector) util.getVecproduto();	   
    			 	System.out.println(produto.size());
    			 	System.out.println("Acima o tamanho");
		   			for(int i =0 ;i < produto.size();i++ ) {
			  			ProdutoForm produtobean = (ProdutoForm)produto.get(i);
			     %>
			     <html:option value="<%=(Integer.toString(produtobean.getCod_produto())) %>">
			     <%=produtobean.getDescricao_produto()%>
			     </html:option>
			    <%} %>
        	</html:select></td>
  </tr>
  <tr>
    <td><strong>Setor Respons&aacute;vel </strong><span class="style5"></span></td>
    <td><html:select property="cod_setor">
    			 <%
		   			Vector setor =(Vector) util.getVecsetor();	   
    			 	System.out.println(setor.size());
    			 	System.out.println("Acima o tamanho");
		   			for(int i =0 ;i < setor.size();i++ ) {
			  			SetorForm setorbean = (SetorForm)setor.get(i);
			     %>
			     <html:option value="<%=(Integer.toString(setorbean.getCod_setor())) %>">
			     <%=setorbean.getNome_setor()%>
			     </html:option>
			    <%} %>
        	</html:select></td>
  </tr>
  <tr>
    <td><strong>Data Cadastramento<span class="style3"></strong></td>
    <td><html:text property="data_abertura" disabled="false" value="<%=util.getDatah()%>" readonly="true" maxlength="8" size="8"> </html:text></td>
  </tr>
     <tr>
    <td><div align="center">
      <input type="reset" name="Reset" value="Voltar">
    </div></td>
    <td><div align="center">
      <input type="submit" name="Submit" value="Cadastrar">
    </div></td>
  </tr>
</table>
</html:form>
</body>
</html:html>